# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        
        # Adding model 'FacebookCredential'
        db.create_table('core_facebookcredential', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('fb_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
        ))
        db.send_create_signal('core', ['FacebookCredential'])

        # Adding model 'Auth'
        db.create_table('core_auth', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('provider', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['core.AuthProvider'])),
            ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['core.User'])),
            ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])),
            ('credential_id', self.gf('django.db.models.fields.PositiveIntegerField')()),
        ))
        db.send_create_signal('core', ['Auth'])

        # Adding model 'VkontakteCredential'
        db.create_table('core_vkontaktecredential', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('vk_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
        ))
        db.send_create_signal('core', ['VkontakteCredential'])

        # Adding model 'OpenIdCredential'
        db.create_table('core_openidcredential', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('open_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
        ))
        db.send_create_signal('core', ['OpenIdCredential'])

        # Adding model 'InternalCredential'
        db.create_table('core_internalcredential', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('login', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
            ('password_hash', self.gf('django.db.models.fields.CharField')(max_length=255)),
        ))
        db.send_create_signal('core', ['InternalCredential'])

        # Adding model 'AuthProvider'
        db.create_table('core_authprovider', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
        ))
        db.send_create_signal('core', ['AuthProvider'])

        # Deleting field 'User.login'
        db.delete_column('core_user', 'login')

        # Deleting field 'User.password_hash'
        db.delete_column('core_user', 'password_hash')

        # Adding field 'User.name'
        db.add_column('core_user', 'name', self.gf('django.db.models.fields.CharField')(default='1', max_length=255), keep_default=False)


    def backwards(self, orm):
        
        # Deleting model 'FacebookCredential'
        db.delete_table('core_facebookcredential')

        # Deleting model 'Auth'
        db.delete_table('core_auth')

        # Deleting model 'VkontakteCredential'
        db.delete_table('core_vkontaktecredential')

        # Deleting model 'OpenIdCredential'
        db.delete_table('core_openidcredential')

        # Deleting model 'InternalCredential'
        db.delete_table('core_internalcredential')

        # Deleting model 'AuthProvider'
        db.delete_table('core_authprovider')

        # Adding field 'User.login'
        db.add_column('core_user', 'login', self.gf('django.db.models.fields.CharField')(default='1', max_length=255), keep_default=False)

        # Adding field 'User.password_hash'
        db.add_column('core_user', 'password_hash', self.gf('django.db.models.fields.CharField')(default='1', max_length=255), keep_default=False)

        # Deleting field 'User.name'
        db.delete_column('core_user', 'name')


    models = {
        'contenttypes.contenttype': {
            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
        },
        'core.auth': {
            'Meta': {'object_name': 'Auth'},
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
            'credential_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'provider': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.AuthProvider']"}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.User']"})
        },
        'core.authprovider': {
            'Meta': {'object_name': 'AuthProvider'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
        },
        'core.facebookcredential': {
            'Meta': {'object_name': 'FacebookCredential'},
            'fb_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
        },
        'core.internalcredential': {
            'Meta': {'object_name': 'InternalCredential'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'login': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
            'password_hash': ('django.db.models.fields.CharField', [], {'max_length': '255'})
        },
        'core.openidcredential': {
            'Meta': {'object_name': 'OpenIdCredential'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'open_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
        },
        'core.user': {
            'Meta': {'object_name': 'User'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
        },
        'core.vkontaktecredential': {
            'Meta': {'object_name': 'VkontakteCredential'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'vk_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
        }
    }

    complete_apps = ['core']
